<?xml version="1.0" encoding="ascii"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
          "DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>ProctorTicket.Utils</title>
  <link rel="stylesheet" href="epydoc.css" type="text/css" />
  <script type="text/javascript" src="epydoc.js"></script>
</head>

<body bgcolor="white" text="black" link="blue" vlink="#204080"
      alink="#204080">
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar" border="0" width="100%" cellpadding="0"
       bgcolor="#a0c0ff" cellspacing="0">
  <tr valign="middle">
  <!-- Home link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="ProctorTicket-module.html">Home</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Tree link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Index link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Help link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Project homepage -->
      <th class="navbar" align="right" width="100%">
        <table border="0" cellpadding="0" cellspacing="0">
          <tr><th class="navbar" align="center"
            ><a class="navbar" target="_top" href="http://code.google.com/p/proctorticket">ProctorTicket</a></th>
          </tr></table></th>
  </tr>
</table>
<table width="100%" cellpadding="0" cellspacing="0">
  <tr valign="top">
    <td width="100%">
      <span class="breadcrumbs">
        <a href="ProctorTicket-module.html">Package&nbsp;ProctorTicket</a> ::
        Module&nbsp;Utils
      </span>
    </td>
    <td>
      <table cellpadding="0" cellspacing="0">
        <!-- hide/show private -->
        <tr><td align="right"><span class="options">[<a href="javascript:void(0);" class="privatelink"
    onclick="toggle_private();">hide&nbsp;private</a>]</span></td></tr>
        <tr><td align="right"><span class="options"
            >[<a href="frames.html" target="_top">frames</a
            >]&nbsp;|&nbsp;<a href="ProctorTicket.Utils-pysrc.html"
            target="_top">no&nbsp;frames</a>]</span></td></tr>
      </table>
    </td>
  </tr>
</table>
<h1 class="epydoc">Source Code for <a href="ProctorTicket.Utils-module.html">Module ProctorTicket.Utils</a></h1>
<pre class="py-src">
<a name="L1"></a><tt class="py-lineno">  1</tt>  <tt class="py-line"><tt class="py-comment">#  Utils.py -- Handy boilerplate code for ProctorTicket</tt> </tt>
<a name="L2"></a><tt class="py-lineno">  2</tt>  <tt class="py-line"><tt class="py-comment"></tt><tt class="py-comment">#  Copyright (C) 2008 Zachary Voase &lt;cracka80@gmail.com&gt;</tt> </tt>
<a name="L3"></a><tt class="py-lineno">  3</tt>  <tt class="py-line"><tt class="py-comment"></tt><tt class="py-comment">#</tt> </tt>
<a name="L4"></a><tt class="py-lineno">  4</tt>  <tt class="py-line"><tt class="py-comment"></tt><tt class="py-comment">#  This program is free software; you can redistribute it and/or</tt> </tt>
<a name="L5"></a><tt class="py-lineno">  5</tt>  <tt class="py-line"><tt class="py-comment"></tt><tt class="py-comment">#  modify it under the terms of the GNU General Public License</tt> </tt>
<a name="L6"></a><tt class="py-lineno">  6</tt>  <tt class="py-line"><tt class="py-comment"></tt><tt class="py-comment">#  as published by the Free Software Foundation; either version 2</tt> </tt>
<a name="L7"></a><tt class="py-lineno">  7</tt>  <tt class="py-line"><tt class="py-comment"></tt><tt class="py-comment">#  of the License, or (at your option) any later version.</tt> </tt>
<a name="L8"></a><tt class="py-lineno">  8</tt>  <tt class="py-line"><tt class="py-comment"></tt><tt class="py-comment">#</tt> </tt>
<a name="L9"></a><tt class="py-lineno">  9</tt>  <tt class="py-line"><tt class="py-comment"></tt><tt class="py-comment">#  This program is distributed in the hope that it will be useful,</tt> </tt>
<a name="L10"></a><tt class="py-lineno"> 10</tt>  <tt class="py-line"><tt class="py-comment"></tt><tt class="py-comment">#  but WITHOUT ANY WARRANTY; without even the implied warranty of</tt> </tt>
<a name="L11"></a><tt class="py-lineno"> 11</tt>  <tt class="py-line"><tt class="py-comment"></tt><tt class="py-comment">#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the</tt> </tt>
<a name="L12"></a><tt class="py-lineno"> 12</tt>  <tt class="py-line"><tt class="py-comment"></tt><tt class="py-comment">#  GNU General Public License for more details.</tt> </tt>
<a name="L13"></a><tt class="py-lineno"> 13</tt>  <tt class="py-line"><tt class="py-comment"></tt><tt class="py-comment">#</tt> </tt>
<a name="L14"></a><tt class="py-lineno"> 14</tt>  <tt class="py-line"><tt class="py-comment"></tt><tt class="py-comment">#  You should have received a copy of the GNU General Public License</tt> </tt>
<a name="L15"></a><tt class="py-lineno"> 15</tt>  <tt class="py-line"><tt class="py-comment"></tt><tt class="py-comment">#  along with this program; if not, write to the Free Software</tt> </tt>
<a name="L16"></a><tt class="py-lineno"> 16</tt>  <tt class="py-line"><tt class="py-comment"></tt><tt class="py-comment">#  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA</tt> </tt>
<a name="L17"></a><tt class="py-lineno"> 17</tt>  <tt class="py-line"><tt class="py-comment"></tt><tt class="py-comment">#  02110-1301, USA.</tt> </tt>
<a name="L18"></a><tt class="py-lineno"> 18</tt>  <tt class="py-line"><tt class="py-comment"></tt> </tt>
<a name="L19"></a><tt class="py-lineno"> 19</tt>  <tt class="py-line"><tt class="py-docstring">"""ProctorTicket.Utils</tt> </tt>
<a name="L20"></a><tt class="py-lineno"> 20</tt>  <tt class="py-line"><tt class="py-docstring">Contains some of the functions and classes used by both halves of the</tt> </tt>
<a name="L21"></a><tt class="py-lineno"> 21</tt>  <tt class="py-line"><tt class="py-docstring">ProctorTicket system, including some functions missing from the Python standard</tt> </tt>
<a name="L22"></a><tt class="py-lineno"> 22</tt>  <tt class="py-line"><tt class="py-docstring">library, like popd and pushd, and a filtered list."""</tt> </tt>
<a name="L23"></a><tt class="py-lineno"> 23</tt>  <tt class="py-line"> </tt>
<a name="L24"></a><tt class="py-lineno"> 24</tt>  <tt class="py-line"><tt class="py-keyword">from</tt> <tt class="py-name">os</tt> <tt class="py-keyword">import</tt> <tt class="py-name">getcwdu</tt><tt class="py-op">,</tt> <tt class="py-name">chdir</tt><tt class="py-op">,</tt> <tt class="py-name">linesep</tt> </tt>
<a name="L25"></a><tt class="py-lineno"> 25</tt>  <tt class="py-line"> </tt>
<a name="FilteredList"></a><div id="FilteredList-def"><a name="L26"></a><tt class="py-lineno"> 26</tt> <a class="py-toggle" href="#" id="FilteredList-toggle" onclick="return toggle('FilteredList');">-</a><tt class="py-line"><tt class="py-keyword">class</tt> <a class="py-def-name" href="ProctorTicket.Utils.FilteredList-class.html">FilteredList</a><tt class="py-op">(</tt><tt class="py-base-class">list</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="FilteredList-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="FilteredList-expanded"><a name="L27"></a><tt class="py-lineno"> 27</tt>  <tt class="py-line">    <tt class="py-docstring">"""FilteredList(&lt;filterFunction: lambda x: True&gt;, *args, **kwargs):</tt> </tt>
<a name="L28"></a><tt class="py-lineno"> 28</tt>  <tt class="py-line"><tt class="py-docstring">A list which can only have items appended to it which pass the 'filterFunction'</tt> </tt>
<a name="L29"></a><tt class="py-lineno"> 29</tt>  <tt class="py-line"><tt class="py-docstring">callable attribute, like an incremental 'filter' function. Handy in the addition</tt> </tt>
<a name="L30"></a><tt class="py-lineno"> 30</tt>  <tt class="py-line"><tt class="py-docstring">of results to a results list, whilst filtering them at the same time instead of</tt> </tt>
<a name="L31"></a><tt class="py-lineno"> 31</tt>  <tt class="py-line"><tt class="py-docstring">having to use intermediate lists and unnecessary memory. By default, the</tt> </tt>
<a name="L32"></a><tt class="py-lineno"> 32</tt>  <tt class="py-line"><tt class="py-docstring">filtering function returns True every time. The remaining arguments will be</tt> </tt>
<a name="L33"></a><tt class="py-lineno"> 33</tt>  <tt class="py-line"><tt class="py-docstring">passed to list.__init__() as entered."""</tt> </tt>
<a name="L34"></a><tt class="py-lineno"> 34</tt>  <tt class="py-line">     </tt>
<a name="FilteredList.__init__"></a><div id="FilteredList.__init__-def"><a name="L35"></a><tt class="py-lineno"> 35</tt> <a class="py-toggle" href="#" id="FilteredList.__init__-toggle" onclick="return toggle('FilteredList.__init__');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="ProctorTicket.Utils.FilteredList-class.html#__init__">__init__</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">filterFunction</tt><tt class="py-op">=</tt><tt class="py-keyword">lambda</tt> <tt class="py-name">x</tt><tt class="py-op">:</tt> <tt class="py-name">True</tt><tt class="py-op">,</tt> <tt class="py-op">*</tt><tt class="py-name">args</tt><tt class="py-op">,</tt> <tt class="py-op">**</tt><tt class="py-name">kwargs</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="FilteredList.__init__-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="FilteredList.__init__-expanded"><a name="L36"></a><tt class="py-lineno"> 36</tt>  <tt class="py-line">        <tt class="py-name">list</tt><tt class="py-op">.</tt><tt id="link-0" class="py-name" targets="Method ProctorTicket.Proctor.Test.__init__()=ProctorTicket.Proctor.Test-class.html#__init__,Method ProctorTicket.Trac.TracDBConn.__init__()=ProctorTicket.Trac.TracDBConn-class.html#__init__,Method ProctorTicket.Utils.FilteredList.__init__()=ProctorTicket.Utils.FilteredList-class.html#__init__"><a title="ProctorTicket.Proctor.Test.__init__
ProctorTicket.Trac.TracDBConn.__init__
ProctorTicket.Utils.FilteredList.__init__" class="py-name" href="#" onclick="return doclink('link-0', '__init__', 'link-0');">__init__</a></tt><tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">,</tt> <tt class="py-op">*</tt><tt class="py-name">args</tt><tt class="py-op">,</tt> <tt class="py-op">**</tt><tt class="py-name">kwargs</tt><tt class="py-op">)</tt> </tt>
<a name="L37"></a><tt class="py-lineno"> 37</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">filterFunction</tt> <tt class="py-op">=</tt> <tt class="py-name">filterFunction</tt> </tt>
</div><a name="L38"></a><tt class="py-lineno"> 38</tt>  <tt class="py-line">     </tt>
<a name="FilteredList.append"></a><div id="FilteredList.append-def"><a name="L39"></a><tt class="py-lineno"> 39</tt> <a class="py-toggle" href="#" id="FilteredList.append-toggle" onclick="return toggle('FilteredList.append');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="ProctorTicket.Utils.FilteredList-class.html#append">append</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-op">*</tt><tt class="py-param">args</tt><tt class="py-op">,</tt> <tt class="py-op">**</tt><tt class="py-param">kwargs</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="FilteredList.append-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="FilteredList.append-expanded"><a name="L40"></a><tt class="py-lineno"> 40</tt>  <tt class="py-line">        <tt class="py-docstring">"""FilteredList.append(item):</tt> </tt>
<a name="L41"></a><tt class="py-lineno"> 41</tt>  <tt class="py-line"><tt class="py-docstring">Modified list.append method: Only adds the item to list if it returns True from</tt> </tt>
<a name="L42"></a><tt class="py-lineno"> 42</tt>  <tt class="py-line"><tt class="py-docstring">the callable attribute 'filterFunction', specified upon instantiation. Whether</tt> </tt>
<a name="L43"></a><tt class="py-lineno"> 43</tt>  <tt class="py-line"><tt class="py-docstring">or not the value passes, it behaves like the normal list.append function (i.e.</tt> </tt>
<a name="L44"></a><tt class="py-lineno"> 44</tt>  <tt class="py-line"><tt class="py-docstring">it returns None)."""</tt> </tt>
<a name="L45"></a><tt class="py-lineno"> 45</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">filterFunction</tt><tt class="py-op">(</tt><tt class="py-op">*</tt><tt class="py-name">args</tt><tt class="py-op">,</tt> <tt class="py-op">**</tt><tt class="py-name">kwargs</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<a name="L46"></a><tt class="py-lineno"> 46</tt>  <tt class="py-line">            <tt class="py-name">list</tt><tt class="py-op">.</tt><tt id="link-1" class="py-name" targets="Method ProctorTicket.Utils.FilteredList.append()=ProctorTicket.Utils.FilteredList-class.html#append"><a title="ProctorTicket.Utils.FilteredList.append" class="py-name" href="#" onclick="return doclink('link-1', 'append', 'link-1');">append</a></tt><tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">,</tt> <tt class="py-op">*</tt><tt class="py-name">args</tt><tt class="py-op">,</tt> <tt class="py-op">**</tt><tt class="py-name">kwargs</tt><tt class="py-op">)</tt> </tt>
</div></div><a name="L47"></a><tt class="py-lineno"> 47</tt>  <tt class="py-line"> </tt>
<a name="L48"></a><tt class="py-lineno"> 48</tt>  <tt class="py-line"><tt id="link-2" class="py-name" targets="Variable ProctorTicket.Utils._dirstack=ProctorTicket.Utils-module.html#_dirstack"><a title="ProctorTicket.Utils._dirstack" class="py-name" href="#" onclick="return doclink('link-2', '_dirstack', 'link-2');">_dirstack</a></tt> <tt class="py-op">=</tt> <tt class="py-op">[</tt> <tt class="py-name">getcwdu</tt><tt class="py-op">(</tt><tt class="py-op">)</tt> <tt class="py-op">]</tt> </tt>
<a name="L49"></a><tt class="py-lineno"> 49</tt>  <tt class="py-line"> </tt>
<a name="pushd"></a><div id="pushd-def"><a name="L50"></a><tt class="py-lineno"> 50</tt> <a class="py-toggle" href="#" id="pushd-toggle" onclick="return toggle('pushd');">-</a><tt class="py-line"><tt class="py-keyword">def</tt> <a class="py-def-name" href="ProctorTicket.Utils-module.html#pushd">pushd</a><tt class="py-op">(</tt><tt class="py-param">path</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="pushd-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="pushd-expanded"><a name="L51"></a><tt class="py-lineno"> 51</tt>  <tt class="py-line">    <tt class="py-docstring">"""pushd(&lt;string: path&gt;):</tt> </tt>
<a name="L52"></a><tt class="py-lineno"> 52</tt>  <tt class="py-line"><tt class="py-docstring">Push current directory onto directory stack, chdir to specified path."""</tt> </tt>
<a name="L53"></a><tt class="py-lineno"> 53</tt>  <tt class="py-line">    <tt id="link-3" class="py-name"><a title="ProctorTicket.Utils._dirstack" class="py-name" href="#" onclick="return doclink('link-3', '_dirstack', 'link-2');">_dirstack</a></tt><tt class="py-op">.</tt><tt id="link-4" class="py-name"><a title="ProctorTicket.Utils.FilteredList.append" class="py-name" href="#" onclick="return doclink('link-4', 'append', 'link-1');">append</a></tt><tt class="py-op">(</tt><tt class="py-name">unicode</tt><tt class="py-op">(</tt><tt class="py-name">path</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
<a name="L54"></a><tt class="py-lineno"> 54</tt>  <tt class="py-line">    <tt class="py-name">chdir</tt><tt class="py-op">(</tt><tt class="py-name">path</tt><tt class="py-op">)</tt> </tt>
</div><a name="L55"></a><tt class="py-lineno"> 55</tt>  <tt class="py-line"> </tt>
<a name="popd"></a><div id="popd-def"><a name="L56"></a><tt class="py-lineno"> 56</tt> <a class="py-toggle" href="#" id="popd-toggle" onclick="return toggle('popd');">-</a><tt class="py-line"><tt class="py-keyword">def</tt> <a class="py-def-name" href="ProctorTicket.Utils-module.html#popd">popd</a><tt class="py-op">(</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="popd-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="popd-expanded"><a name="L57"></a><tt class="py-lineno"> 57</tt>  <tt class="py-line">    <tt class="py-docstring">"""popd():</tt> </tt>
<a name="L58"></a><tt class="py-lineno"> 58</tt>  <tt class="py-line"><tt class="py-docstring">Remove current directory from stack, chdir back to last visited path."""</tt> </tt>
<a name="L59"></a><tt class="py-lineno"> 59</tt>  <tt class="py-line">    <tt id="link-5" class="py-name"><a title="ProctorTicket.Utils._dirstack" class="py-name" href="#" onclick="return doclink('link-5', '_dirstack', 'link-2');">_dirstack</a></tt><tt class="py-op">.</tt><tt class="py-name">pop</tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L60"></a><tt class="py-lineno"> 60</tt>  <tt class="py-line">    <tt class="py-name">chdir</tt><tt class="py-op">(</tt><tt id="link-6" class="py-name"><a title="ProctorTicket.Utils._dirstack" class="py-name" href="#" onclick="return doclink('link-6', '_dirstack', 'link-2');">_dirstack</a></tt><tt class="py-op">[</tt><tt class="py-op">-</tt><tt class="py-number">1</tt><tt class="py-op">]</tt><tt class="py-op">)</tt> </tt>
</div><a name="L61"></a><tt class="py-lineno"> 61</tt>  <tt class="py-line"> </tt>
<a name="dirs"></a><div id="dirs-def"><a name="L62"></a><tt class="py-lineno"> 62</tt> <a class="py-toggle" href="#" id="dirs-toggle" onclick="return toggle('dirs');">-</a><tt class="py-line"><tt class="py-keyword">def</tt> <a class="py-def-name" href="ProctorTicket.Utils-module.html#dirs">dirs</a><tt class="py-op">(</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="dirs-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="dirs-expanded"><a name="L63"></a><tt class="py-lineno"> 63</tt>  <tt class="py-line">    <tt class="py-docstring">"""dirs():</tt> </tt>
<a name="L64"></a><tt class="py-lineno"> 64</tt>  <tt class="py-line"><tt class="py-docstring">Returns concatenated string of directory stack."""</tt> </tt>
<a name="L65"></a><tt class="py-lineno"> 65</tt>  <tt class="py-line">    <tt class="py-keyword">return</tt> <tt class="py-string">" "</tt><tt class="py-op">.</tt><tt class="py-name">join</tt><tt class="py-op">(</tt><tt id="link-7" class="py-name"><a title="ProctorTicket.Utils._dirstack" class="py-name" href="#" onclick="return doclink('link-7', '_dirstack', 'link-2');">_dirstack</a></tt><tt class="py-op">)</tt> </tt>
</div><a name="L66"></a><tt class="py-lineno"> 66</tt>  <tt class="py-line"> </tt>
<a name="L67"></a><tt class="py-lineno"> 67</tt>  <tt class="py-line"><tt id="link-8" class="py-name" targets="Variable ProctorTicket.Utils._RESULT_DICT_DEFAULTS=ProctorTicket.Utils-module.html#_RESULT_DICT_DEFAULTS"><a title="ProctorTicket.Utils._RESULT_DICT_DEFAULTS" class="py-name" href="#" onclick="return doclink('link-8', '_RESULT_DICT_DEFAULTS', 'link-8');">_RESULT_DICT_DEFAULTS</a></tt> <tt class="py-op">=</tt> <tt class="py-op">{</tt> </tt>
<a name="L68"></a><tt class="py-lineno"> 68</tt>  <tt class="py-line">    <tt class="py-string">'type'</tt><tt class="py-op">:</tt> <tt class="py-string">'defect'</tt><tt class="py-op">,</tt> </tt>
<a name="L69"></a><tt class="py-lineno"> 69</tt>  <tt class="py-line">    <tt class="py-string">'component'</tt><tt class="py-op">:</tt> <tt class="py-string">'general'</tt><tt class="py-op">,</tt> </tt>
<a name="L70"></a><tt class="py-lineno"> 70</tt>  <tt class="py-line">    <tt class="py-string">'priority'</tt><tt class="py-op">:</tt> <tt class="py-string">'normal'</tt><tt class="py-op">,</tt> </tt>
<a name="L71"></a><tt class="py-lineno"> 71</tt>  <tt class="py-line">    <tt class="py-string">'status'</tt><tt class="py-op">:</tt> <tt class="py-string">'new'</tt> </tt>
<a name="L72"></a><tt class="py-lineno"> 72</tt>  <tt class="py-line"><tt class="py-op">}</tt> </tt>
<a name="L73"></a><tt class="py-lineno"> 73</tt>  <tt class="py-line"> </tt>
<a name="dictFilter"></a><div id="dictFilter-def"><a name="L74"></a><tt class="py-lineno"> 74</tt> <a class="py-toggle" href="#" id="dictFilter-toggle" onclick="return toggle('dictFilter');">-</a><tt class="py-line"><tt class="py-keyword">def</tt> <a class="py-def-name" href="ProctorTicket.Utils-module.html#dictFilter">dictFilter</a><tt class="py-op">(</tt><tt class="py-param">function</tt><tt class="py-op">,</tt> <tt class="py-param">dictIn</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="dictFilter-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="dictFilter-expanded"><a name="L75"></a><tt class="py-lineno"> 75</tt>  <tt class="py-line">    <tt class="py-name">dictOut</tt> <tt class="py-op">=</tt> <tt class="py-op">{</tt><tt class="py-op">}</tt> </tt>
<a name="L76"></a><tt class="py-lineno"> 76</tt>  <tt class="py-line">    <tt class="py-keyword">for</tt> <tt class="py-name">key</tt><tt class="py-op">,</tt> <tt class="py-name">value</tt> <tt class="py-keyword">in</tt> <tt class="py-name">dictIn</tt><tt class="py-op">.</tt><tt class="py-name">items</tt><tt class="py-op">(</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<a name="L77"></a><tt class="py-lineno"> 77</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-name">function</tt><tt class="py-op">(</tt><tt class="py-name">key</tt><tt class="py-op">,</tt> <tt class="py-name">value</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<a name="L78"></a><tt class="py-lineno"> 78</tt>  <tt class="py-line">            <tt class="py-name">dictOut</tt><tt class="py-op">[</tt><tt class="py-name">key</tt><tt class="py-op">]</tt> <tt class="py-op">=</tt> <tt class="py-name">value</tt> </tt>
<a name="L79"></a><tt class="py-lineno"> 79</tt>  <tt class="py-line">    <tt class="py-keyword">return</tt> <tt class="py-name">dictOut</tt> </tt>
</div><a name="L80"></a><tt class="py-lineno"> 80</tt>  <tt class="py-line"> </tt>
<a name="dictEmptiness"></a><div id="dictEmptiness-def"><a name="L81"></a><tt class="py-lineno"> 81</tt> <a class="py-toggle" href="#" id="dictEmptiness-toggle" onclick="return toggle('dictEmptiness');">-</a><tt class="py-line"><tt class="py-keyword">def</tt> <a class="py-def-name" href="ProctorTicket.Utils-module.html#dictEmptiness">dictEmptiness</a><tt class="py-op">(</tt><tt class="py-param">key</tt><tt class="py-op">,</tt> <tt class="py-param">value</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="dictEmptiness-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="dictEmptiness-expanded"><a name="L82"></a><tt class="py-lineno"> 82</tt>  <tt class="py-line">    <tt class="py-keyword">if</tt> <tt class="py-name">value</tt> <tt class="py-keyword">in</tt> <tt class="py-op">[</tt> <tt class="py-string">""</tt><tt class="py-op">,</tt> <tt class="py-string">u""</tt><tt class="py-op">,</tt> <tt class="py-number">0</tt><tt class="py-op">,</tt> <tt class="py-name">None</tt><tt class="py-op">,</tt> <tt class="py-op">[</tt><tt class="py-op">]</tt><tt class="py-op">,</tt> <tt class="py-op">(</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> <tt class="py-number">0.0</tt><tt class="py-op">,</tt> <tt class="py-op">{</tt><tt class="py-op">}</tt> <tt class="py-op">]</tt><tt class="py-op">:</tt> </tt>
<a name="L83"></a><tt class="py-lineno"> 83</tt>  <tt class="py-line">        <tt class="py-keyword">return</tt> <tt class="py-name">False</tt> </tt>
<a name="L84"></a><tt class="py-lineno"> 84</tt>  <tt class="py-line">    <tt class="py-keyword">return</tt> <tt class="py-name">True</tt> </tt>
</div><a name="L85"></a><tt class="py-lineno"> 85</tt>  <tt class="py-line"> </tt>
<a name="DefaultSummariser"></a><div id="DefaultSummariser-def"><a name="L86"></a><tt class="py-lineno"> 86</tt> <a class="py-toggle" href="#" id="DefaultSummariser-toggle" onclick="return toggle('DefaultSummariser');">-</a><tt class="py-line"><tt class="py-keyword">def</tt> <a class="py-def-name" href="ProctorTicket.Utils-module.html#DefaultSummariser">DefaultSummariser</a><tt class="py-op">(</tt><tt class="py-param">resultslist</tt><tt class="py-op">,</tt> <tt class="py-op">**</tt><tt class="py-param">kwargs</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="DefaultSummariser-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="DefaultSummariser-expanded"><a name="L87"></a><tt class="py-lineno"> 87</tt>  <tt class="py-line">    <tt class="py-docstring">"""DefaultSummariser(&lt;list: proctorlib.result.TestResult&gt;, **kwargs):</tt> </tt>
<a name="L88"></a><tt class="py-lineno"> 88</tt>  <tt class="py-line"><tt class="py-docstring">The default summarising action takes a list of results and returns</tt> </tt>
<a name="L89"></a><tt class="py-lineno"> 89</tt>  <tt class="py-line"><tt class="py-docstring">the test class to which those results belong. The results should</tt> </tt>
<a name="L90"></a><tt class="py-lineno"> 90</tt>  <tt class="py-line"><tt class="py-docstring">already have been grouped accordingly by their test class, so this</tt> </tt>
<a name="L91"></a><tt class="py-lineno"> 91</tt>  <tt class="py-line"><tt class="py-docstring">function will use the test class of the first item of the list, </tt> </tt>
<a name="L92"></a><tt class="py-lineno"> 92</tt>  <tt class="py-line"><tt class="py-docstring">appended by '(proctor)', which should be unique enough for the</tt> </tt>
<a name="L93"></a><tt class="py-lineno"> 93</tt>  <tt class="py-line"><tt class="py-docstring">summary field to be distinctive.</tt> </tt>
<a name="L94"></a><tt class="py-lineno"> 94</tt>  <tt class="py-line"><tt class="py-docstring">Example: 'proctorlib.tests.ExampleTestCase (proctor)'"""</tt> </tt>
<a name="L95"></a><tt class="py-lineno"> 95</tt>  <tt class="py-line">    <tt class="py-keyword">return</tt> <tt id="link-9" class="py-name" targets="Function ProctorTicket.Utils.GetTestClass()=ProctorTicket.Utils-module.html#GetTestClass"><a title="ProctorTicket.Utils.GetTestClass" class="py-name" href="#" onclick="return doclink('link-9', 'GetTestClass', 'link-9');">GetTestClass</a></tt><tt class="py-op">(</tt><tt class="py-name">resultslist</tt><tt class="py-op">[</tt><tt class="py-number">0</tt><tt class="py-op">]</tt><tt class="py-op">)</tt> <tt class="py-op">+</tt> <tt class="py-string">' (proctor)'</tt> </tt>
</div><a name="L96"></a><tt class="py-lineno"> 96</tt>  <tt class="py-line"> </tt>
<a name="ResultEquality"></a><div id="ResultEquality-def"><a name="L97"></a><tt class="py-lineno"> 97</tt> <a class="py-toggle" href="#" id="ResultEquality-toggle" onclick="return toggle('ResultEquality');">-</a><tt class="py-line"><tt class="py-keyword">def</tt> <a class="py-def-name" href="ProctorTicket.Utils-module.html#ResultEquality">ResultEquality</a><tt class="py-op">(</tt><tt class="py-param">result1</tt><tt class="py-op">,</tt> <tt class="py-param">result2</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="ResultEquality-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="ResultEquality-expanded"><a name="L98"></a><tt class="py-lineno"> 98</tt>  <tt class="py-line">    <tt class="py-keyword">if</tt> <tt class="py-keyword">not</tt> <tt id="link-10" class="py-name"><a title="ProctorTicket.Utils.GetTestClass" class="py-name" href="#" onclick="return doclink('link-10', 'GetTestClass', 'link-9');">GetTestClass</a></tt><tt class="py-op">(</tt><tt class="py-name">result1</tt><tt class="py-op">)</tt> <tt class="py-op">==</tt> <tt id="link-11" class="py-name"><a title="ProctorTicket.Utils.GetTestClass" class="py-name" href="#" onclick="return doclink('link-11', 'GetTestClass', 'link-9');">GetTestClass</a></tt><tt class="py-op">(</tt><tt class="py-name">result2</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<a name="L99"></a><tt class="py-lineno"> 99</tt>  <tt class="py-line">        <tt class="py-keyword">return</tt> <tt class="py-name">False</tt> </tt>
<a name="L100"></a><tt class="py-lineno">100</tt>  <tt class="py-line">    <tt class="py-keyword">elif</tt> <tt class="py-keyword">not</tt> <tt class="py-name">result1</tt><tt class="py-op">.</tt><tt class="py-name">status</tt> <tt class="py-op">==</tt> <tt class="py-name">result2</tt><tt class="py-op">.</tt><tt class="py-name">status</tt><tt class="py-op">:</tt> </tt>
<a name="L101"></a><tt class="py-lineno">101</tt>  <tt class="py-line">        <tt class="py-keyword">return</tt> <tt class="py-name">False</tt> </tt>
<a name="L102"></a><tt class="py-lineno">102</tt>  <tt class="py-line">    <tt class="py-keyword">if</tt> <tt class="py-name">result1</tt><tt class="py-op">.</tt><tt class="py-name">output</tt> <tt class="py-op">==</tt> <tt class="py-name">result2</tt><tt class="py-op">.</tt><tt class="py-name">output</tt><tt class="py-op">:</tt> </tt>
<a name="L103"></a><tt class="py-lineno">103</tt>  <tt class="py-line">        <tt class="py-keyword">return</tt> <tt class="py-name">True</tt> </tt>
<a name="L104"></a><tt class="py-lineno">104</tt>  <tt class="py-line">    <tt class="py-name">output1</tt> <tt class="py-op">=</tt> <tt class="py-name">result1</tt><tt class="py-op">.</tt><tt class="py-name">output</tt><tt class="py-op">.</tt><tt class="py-name">split</tt><tt class="py-op">(</tt><tt class="py-name">linesep</tt><tt class="py-op">,</tt> <tt class="py-number">1</tt><tt class="py-op">)</tt> </tt>
<a name="L105"></a><tt class="py-lineno">105</tt>  <tt class="py-line">    <tt class="py-name">output2</tt> <tt class="py-op">=</tt> <tt class="py-name">result2</tt><tt class="py-op">.</tt><tt class="py-name">output</tt><tt class="py-op">.</tt><tt class="py-name">split</tt><tt class="py-op">(</tt><tt class="py-name">linesep</tt><tt class="py-op">,</tt> <tt class="py-number">1</tt><tt class="py-op">)</tt> </tt>
<a name="L106"></a><tt class="py-lineno">106</tt>  <tt class="py-line">    <tt class="py-keyword">if</tt> <tt class="py-name">output1</tt><tt class="py-op">[</tt><tt class="py-number">1</tt><tt class="py-op">]</tt> <tt class="py-op">==</tt> <tt class="py-name">output2</tt><tt class="py-op">[</tt><tt class="py-number">1</tt><tt class="py-op">]</tt><tt class="py-op">:</tt> </tt>
<a name="L107"></a><tt class="py-lineno">107</tt>  <tt class="py-line">        <tt class="py-keyword">return</tt> <tt class="py-name">True</tt> </tt>
<a name="L108"></a><tt class="py-lineno">108</tt>  <tt class="py-line">    <tt class="py-keyword">return</tt> <tt class="py-name">False</tt> </tt>
</div><a name="L109"></a><tt class="py-lineno">109</tt>  <tt class="py-line"> </tt>
<a name="UniquifyResults"></a><div id="UniquifyResults-def"><a name="L110"></a><tt class="py-lineno">110</tt> <a class="py-toggle" href="#" id="UniquifyResults-toggle" onclick="return toggle('UniquifyResults');">-</a><tt class="py-line"><tt class="py-keyword">def</tt> <a class="py-def-name" href="ProctorTicket.Utils-module.html#UniquifyResults">UniquifyResults</a><tt class="py-op">(</tt><tt class="py-param">listin</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="UniquifyResults-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="UniquifyResults-expanded"><a name="L111"></a><tt class="py-lineno">111</tt>  <tt class="py-line">    <tt class="py-docstring">"""UniquifyResults(&lt;list: proctorlib.result.TestResult&gt;):</tt> </tt>
<a name="L112"></a><tt class="py-lineno">112</tt>  <tt class="py-line"><tt class="py-docstring">Returns a list of results from the results list where duplicates have been</tt> </tt>
<a name="L113"></a><tt class="py-lineno">113</tt>  <tt class="py-line"><tt class="py-docstring">removed. This is done by testing for equality between the output,</tt> </tt>
<a name="L114"></a><tt class="py-lineno">114</tt>  <tt class="py-line"><tt class="py-docstring">status and test class of the tests, which is handled by the ResultEquality</tt> </tt>
<a name="L115"></a><tt class="py-lineno">115</tt>  <tt class="py-line"><tt class="py-docstring">function, and deleting one if they are equal."""</tt> </tt>
<a name="L116"></a><tt class="py-lineno">116</tt>  <tt class="py-line">    <tt class="py-name">resultslist</tt> <tt class="py-op">=</tt> <tt class="py-name">listin</tt><tt class="py-op">[</tt><tt class="py-op">:</tt><tt class="py-op">]</tt> </tt>
<a name="L117"></a><tt class="py-lineno">117</tt>  <tt class="py-line">    <tt class="py-name">listout</tt> <tt class="py-op">=</tt> <tt class="py-op">[</tt><tt class="py-op">]</tt> </tt>
<a name="L118"></a><tt class="py-lineno">118</tt>  <tt class="py-line">    <tt class="py-keyword">while</tt> <tt class="py-name">True</tt><tt class="py-op">:</tt> </tt>
<a name="L119"></a><tt class="py-lineno">119</tt>  <tt class="py-line">        <tt class="py-keyword">try</tt><tt class="py-op">:</tt> </tt>
<a name="L120"></a><tt class="py-lineno">120</tt>  <tt class="py-line">            <tt class="py-name">currentitem</tt> <tt class="py-op">=</tt> <tt class="py-name">resultslist</tt><tt class="py-op">.</tt><tt class="py-name">pop</tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L121"></a><tt class="py-lineno">121</tt>  <tt class="py-line">        <tt class="py-keyword">except</tt> <tt class="py-name">IndexError</tt><tt class="py-op">:</tt> </tt>
<a name="L122"></a><tt class="py-lineno">122</tt>  <tt class="py-line">            <tt class="py-keyword">break</tt> </tt>
<a name="L123"></a><tt class="py-lineno">123</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-string">'build'</tt> <tt class="py-keyword">in</tt> <tt id="link-12" class="py-name"><a title="ProctorTicket.Utils.GetTestClass" class="py-name" href="#" onclick="return doclink('link-12', 'GetTestClass', 'link-9');">GetTestClass</a></tt><tt class="py-op">(</tt><tt class="py-name">currentitem</tt><tt class="py-op">)</tt><tt class="py-op">.</tt><tt class="py-name">split</tt><tt class="py-op">(</tt><tt class="py-string">"."</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<a name="L124"></a><tt class="py-lineno">124</tt>  <tt class="py-line">            <tt class="py-keyword">continue</tt> </tt>
<a name="L125"></a><tt class="py-lineno">125</tt>  <tt class="py-line">        <tt class="py-keyword">for</tt> <tt class="py-name">i</tt> <tt class="py-keyword">in</tt> <tt class="py-name">range</tt><tt class="py-op">(</tt><tt class="py-name">len</tt><tt class="py-op">(</tt><tt class="py-name">resultslist</tt><tt class="py-op">)</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<a name="L126"></a><tt class="py-lineno">126</tt>  <tt class="py-line">            <tt class="py-keyword">if</tt> <tt id="link-13" class="py-name" targets="Function ProctorTicket.Utils.ResultEquality()=ProctorTicket.Utils-module.html#ResultEquality"><a title="ProctorTicket.Utils.ResultEquality" class="py-name" href="#" onclick="return doclink('link-13', 'ResultEquality', 'link-13');">ResultEquality</a></tt><tt class="py-op">(</tt><tt class="py-name">currentitem</tt><tt class="py-op">,</tt> <tt class="py-name">resultslist</tt><tt class="py-op">[</tt><tt class="py-name">i</tt><tt class="py-op">]</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<a name="L127"></a><tt class="py-lineno">127</tt>  <tt class="py-line">                <tt class="py-keyword">del</tt> <tt class="py-name">resultslist</tt><tt class="py-op">[</tt><tt class="py-name">i</tt><tt class="py-op">]</tt> </tt>
<a name="L128"></a><tt class="py-lineno">128</tt>  <tt class="py-line">        <tt class="py-name">listout</tt><tt class="py-op">.</tt><tt id="link-14" class="py-name"><a title="ProctorTicket.Utils.FilteredList.append" class="py-name" href="#" onclick="return doclink('link-14', 'append', 'link-1');">append</a></tt><tt class="py-op">(</tt><tt class="py-name">currentitem</tt><tt class="py-op">)</tt> </tt>
<a name="L129"></a><tt class="py-lineno">129</tt>  <tt class="py-line">    <tt class="py-keyword">return</tt> <tt class="py-name">listout</tt> </tt>
</div><a name="L130"></a><tt class="py-lineno">130</tt>  <tt class="py-line"> </tt>
<a name="GetFuncName"></a><div id="GetFuncName-def"><a name="L131"></a><tt class="py-lineno">131</tt> <a class="py-toggle" href="#" id="GetFuncName-toggle" onclick="return toggle('GetFuncName');">-</a><tt class="py-line"><tt class="py-keyword">def</tt> <a class="py-def-name" href="ProctorTicket.Utils-module.html#GetFuncName">GetFuncName</a><tt class="py-op">(</tt><tt class="py-param">result</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="GetFuncName-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="GetFuncName-expanded"><a name="L132"></a><tt class="py-lineno">132</tt>  <tt class="py-line">    <tt class="py-docstring">"""GetFuncName(&lt;proctorlib.result.TestResult&gt;):</tt> </tt>
<a name="L133"></a><tt class="py-lineno">133</tt>  <tt class="py-line"><tt class="py-docstring">Returns the specific function name of a test result."""</tt> </tt>
<a name="L134"></a><tt class="py-lineno">134</tt>  <tt class="py-line">    <tt class="py-keyword">return</tt> <tt class="py-name">result</tt><tt class="py-op">.</tt><tt class="py-name">name</tt><tt class="py-op">.</tt><tt class="py-name">split</tt><tt class="py-op">(</tt><tt class="py-string">"."</tt><tt class="py-op">)</tt><tt class="py-op">[</tt><tt class="py-op">-</tt><tt class="py-number">1</tt><tt class="py-op">]</tt> </tt>
</div><a name="L135"></a><tt class="py-lineno">135</tt>  <tt class="py-line"> </tt>
<a name="GetTestClass"></a><div id="GetTestClass-def"><a name="L136"></a><tt class="py-lineno">136</tt> <a class="py-toggle" href="#" id="GetTestClass-toggle" onclick="return toggle('GetTestClass');">-</a><tt class="py-line"><tt class="py-keyword">def</tt> <a class="py-def-name" href="ProctorTicket.Utils-module.html#GetTestClass">GetTestClass</a><tt class="py-op">(</tt><tt class="py-param">result</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="GetTestClass-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="GetTestClass-expanded"><a name="L137"></a><tt class="py-lineno">137</tt>  <tt class="py-line">    <tt class="py-docstring">"""GetTestClass(&lt;proctorlib.result.TestResult&gt;):</tt> </tt>
<a name="L138"></a><tt class="py-lineno">138</tt>  <tt class="py-line"><tt class="py-docstring">Takes a TestResult and returns the test class it belongs to, by removing the</tt> </tt>
<a name="L139"></a><tt class="py-lineno">139</tt>  <tt class="py-line"><tt class="py-docstring">last name from the dotted module name held in its 'name' attribute."""</tt> </tt>
<a name="L140"></a><tt class="py-lineno">140</tt>  <tt class="py-line">    <tt class="py-keyword">return</tt> <tt class="py-string">"."</tt><tt class="py-op">.</tt><tt class="py-name">join</tt><tt class="py-op">(</tt><tt class="py-name">result</tt><tt class="py-op">.</tt><tt class="py-name">name</tt><tt class="py-op">.</tt><tt class="py-name">split</tt><tt class="py-op">(</tt><tt class="py-string">" "</tt><tt class="py-op">)</tt><tt class="py-op">[</tt><tt class="py-number">1</tt><tt class="py-op">]</tt><tt class="py-op">.</tt><tt class="py-name">split</tt><tt class="py-op">(</tt><tt class="py-string">"."</tt><tt class="py-op">)</tt><tt class="py-op">[</tt><tt class="py-op">:</tt><tt class="py-op">-</tt><tt class="py-number">1</tt><tt class="py-op">]</tt><tt class="py-op">)</tt> </tt>
</div><a name="L141"></a><tt class="py-lineno">141</tt>  <tt class="py-line"> </tt>
<a name="DefaultDescriptor"></a><div id="DefaultDescriptor-def"><a name="L142"></a><tt class="py-lineno">142</tt> <a class="py-toggle" href="#" id="DefaultDescriptor-toggle" onclick="return toggle('DefaultDescriptor');">-</a><tt class="py-line"><tt class="py-keyword">def</tt> <a class="py-def-name" href="ProctorTicket.Utils-module.html#DefaultDescriptor">DefaultDescriptor</a><tt class="py-op">(</tt><tt class="py-param">results</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="DefaultDescriptor-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="DefaultDescriptor-expanded"><a name="L143"></a><tt class="py-lineno">143</tt>  <tt class="py-line">    <tt class="py-docstring">"""DefaultDescriptor(&lt;list: proctorlib.result.TestResult&gt;):</tt> </tt>
<a name="L144"></a><tt class="py-lineno">144</tt>  <tt class="py-line"><tt class="py-docstring">Takes a list of results for use in a ticket and generate a description which</tt> </tt>
<a name="L145"></a><tt class="py-lineno">145</tt>  <tt class="py-line"><tt class="py-docstring">contains the output for each test in the list, in Trac wiki markup. They are</tt> </tt>
<a name="L146"></a><tt class="py-lineno">146</tt>  <tt class="py-line"><tt class="py-docstring">separated by a line of 20 hyphen ('-') characters, and so can be split up</tt> </tt>
<a name="L147"></a><tt class="py-lineno">147</tt>  <tt class="py-line"><tt class="py-docstring">using str.split."""</tt> </tt>
<a name="L148"></a><tt class="py-lineno">148</tt>  <tt class="py-line">    <tt class="py-name">listOut</tt> <tt class="py-op">=</tt> <tt class="py-op">[</tt><tt class="py-op">]</tt> </tt>
<a name="L149"></a><tt class="py-lineno">149</tt>  <tt class="py-line">    <tt class="py-keyword">for</tt> <tt class="py-name">i</tt> <tt class="py-keyword">in</tt> <tt class="py-name">range</tt><tt class="py-op">(</tt><tt class="py-name">len</tt><tt class="py-op">(</tt><tt class="py-name">results</tt><tt class="py-op">)</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<a name="L150"></a><tt class="py-lineno">150</tt>  <tt class="py-line">        <tt class="py-name">result</tt> <tt class="py-op">=</tt> <tt class="py-name">results</tt><tt class="py-op">[</tt><tt class="py-name">i</tt><tt class="py-op">]</tt> </tt>
<a name="L151"></a><tt class="py-lineno">151</tt>  <tt class="py-line">        <tt class="py-name">subList</tt> <tt class="py-op">=</tt> <tt class="py-op">[</tt><tt class="py-op">]</tt> </tt>
<a name="L152"></a><tt class="py-lineno">152</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-name">i</tt> <tt class="py-keyword">is</tt> <tt class="py-keyword">not</tt> <tt class="py-number">0</tt><tt class="py-op">:</tt> </tt>
<a name="L153"></a><tt class="py-lineno">153</tt>  <tt class="py-line">            <tt class="py-name">subList</tt><tt class="py-op">.</tt><tt id="link-15" class="py-name"><a title="ProctorTicket.Utils.FilteredList.append" class="py-name" href="#" onclick="return doclink('link-15', 'append', 'link-1');">append</a></tt><tt class="py-op">(</tt><tt class="py-string">"-"</tt><tt class="py-op">*</tt><tt class="py-number">20</tt><tt class="py-op">)</tt> </tt>
<a name="L154"></a><tt class="py-lineno">154</tt>  <tt class="py-line">        <tt class="py-name">subList</tt><tt class="py-op">.</tt><tt id="link-16" class="py-name"><a title="ProctorTicket.Utils.FilteredList.append" class="py-name" href="#" onclick="return doclink('link-16', 'append', 'link-1');">append</a></tt><tt class="py-op">(</tt> <tt class="py-string">"=== %s ==="</tt> <tt class="py-op">%</tt> <tt class="py-op">(</tt><tt class="py-name">result</tt><tt class="py-op">.</tt><tt class="py-name">name</tt><tt class="py-op">,</tt><tt class="py-op">)</tt> <tt class="py-op">)</tt> </tt>
<a name="L155"></a><tt class="py-lineno">155</tt>  <tt class="py-line">        <tt class="py-name">subList</tt><tt class="py-op">.</tt><tt id="link-17" class="py-name"><a title="ProctorTicket.Utils.FilteredList.append" class="py-name" href="#" onclick="return doclink('link-17', 'append', 'link-1');">append</a></tt><tt class="py-op">(</tt> <tt class="py-string">"{{{"</tt> <tt class="py-op">)</tt> </tt>
<a name="L156"></a><tt class="py-lineno">156</tt>  <tt class="py-line">        <tt class="py-name">subList</tt><tt class="py-op">.</tt><tt id="link-18" class="py-name"><a title="ProctorTicket.Utils.FilteredList.append" class="py-name" href="#" onclick="return doclink('link-18', 'append', 'link-1');">append</a></tt><tt class="py-op">(</tt> <tt class="py-name">result</tt><tt class="py-op">.</tt><tt class="py-name">output</tt> <tt class="py-op">)</tt> </tt>
<a name="L157"></a><tt class="py-lineno">157</tt>  <tt class="py-line">        <tt class="py-name">subList</tt><tt class="py-op">.</tt><tt id="link-19" class="py-name"><a title="ProctorTicket.Utils.FilteredList.append" class="py-name" href="#" onclick="return doclink('link-19', 'append', 'link-1');">append</a></tt><tt class="py-op">(</tt> <tt class="py-string">"}}}"</tt> <tt class="py-op">)</tt> </tt>
<a name="L158"></a><tt class="py-lineno">158</tt>  <tt class="py-line">        <tt class="py-name">listOut</tt><tt class="py-op">.</tt><tt id="link-20" class="py-name"><a title="ProctorTicket.Utils.FilteredList.append" class="py-name" href="#" onclick="return doclink('link-20', 'append', 'link-1');">append</a></tt><tt class="py-op">(</tt><tt class="py-name">linesep</tt><tt class="py-op">.</tt><tt class="py-name">join</tt><tt class="py-op">(</tt><tt class="py-name">subList</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
<a name="L159"></a><tt class="py-lineno">159</tt>  <tt class="py-line">    <tt class="py-keyword">return</tt> <tt class="py-name">linesep</tt><tt class="py-op">.</tt><tt class="py-name">join</tt><tt class="py-op">(</tt><tt class="py-name">listOut</tt><tt class="py-op">)</tt> </tt>
</div><a name="L160"></a><tt class="py-lineno">160</tt>  <tt class="py-line"> </tt>
<a name="Results2TicketDict"></a><div id="Results2TicketDict-def"><a name="L161"></a><tt class="py-lineno">161</tt> <a class="py-toggle" href="#" id="Results2TicketDict-toggle" onclick="return toggle('Results2TicketDict');">-</a><tt class="py-line"><tt class="py-keyword">def</tt> <a class="py-def-name" href="ProctorTicket.Utils-module.html#Results2TicketDict">Results2TicketDict</a><tt class="py-op">(</tt><tt class="py-param">results</tt><tt class="py-op">,</tt> <tt class="py-param">summariser</tt><tt class="py-op">=</tt><tt id="link-21" class="py-name" targets="Function ProctorTicket.Utils.DefaultSummariser()=ProctorTicket.Utils-module.html#DefaultSummariser"><a title="ProctorTicket.Utils.DefaultSummariser" class="py-name" href="#" onclick="return doclink('link-21', 'DefaultSummariser', 'link-21');">DefaultSummariser</a></tt><tt class="py-op">,</tt> <tt class="py-param">descriptor</tt><tt class="py-op">=</tt><tt id="link-22" class="py-name" targets="Function ProctorTicket.Utils.DefaultDescriptor()=ProctorTicket.Utils-module.html#DefaultDescriptor"><a title="ProctorTicket.Utils.DefaultDescriptor" class="py-name" href="#" onclick="return doclink('link-22', 'DefaultDescriptor', 'link-22');">DefaultDescriptor</a></tt><tt class="py-op">,</tt> <tt class="py-op">**</tt><tt class="py-param">kwargs</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="Results2TicketDict-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="Results2TicketDict-expanded"><a name="L162"></a><tt class="py-lineno">162</tt>  <tt class="py-line">    <tt class="py-docstring">"""Results2TicketDict(&lt;proctorlib.result.TestResult&gt;, &lt;summariser: DefaultSummariser&gt;, &lt;descriptor: DefaultDescriptor&gt;, **kwargs):</tt> </tt>
<a name="L163"></a><tt class="py-lineno">163</tt>  <tt class="py-line"><tt class="py-docstring">Takes a list of TestResult objects, and some keyword arguments, and returns a dictionary</tt> </tt>
<a name="L164"></a><tt class="py-lineno">164</tt>  <tt class="py-line"><tt class="py-docstring">containing the valid field names for the Trac ticket table. The 'summariser'</tt> </tt>
<a name="L165"></a><tt class="py-lineno">165</tt>  <tt class="py-line"><tt class="py-docstring">keyword argument specifies a function which produces a string to be used as the</tt> </tt>
<a name="L166"></a><tt class="py-lineno">166</tt>  <tt class="py-line"><tt class="py-docstring">unique ticket summary. This will receive the TestResult list as the only argument.</tt> </tt>
<a name="L167"></a><tt class="py-lineno">167</tt>  <tt class="py-line"><tt class="py-docstring">The 'descriptor' keyword receives the list of results also and is responsible for</tt> </tt>
<a name="L168"></a><tt class="py-lineno">168</tt>  <tt class="py-line"><tt class="py-docstring">the generation of the description of the ticket in Trac.</tt> </tt>
<a name="L169"></a><tt class="py-lineno">169</tt>  <tt class="py-line"><tt class="py-docstring">By specifying extra keyword arguments, you can change the values of the ticket</tt> </tt>
<a name="L170"></a><tt class="py-lineno">170</tt>  <tt class="py-line"><tt class="py-docstring">fields. Extra keywords must be valid according to the field list held in the list</tt> </tt>
<a name="L171"></a><tt class="py-lineno">171</tt>  <tt class="py-line"><tt class="py-docstring">ProctorTicket.Trac._TICKET_FIELDS."""</tt> </tt>
<a name="L172"></a><tt class="py-lineno">172</tt>  <tt class="py-line">    <tt class="py-name">dictOut</tt> <tt class="py-op">=</tt> <tt class="py-op">{</tt> </tt>
<a name="L173"></a><tt class="py-lineno">173</tt>  <tt class="py-line">        <tt class="py-string">'id'</tt><tt class="py-op">:</tt><tt class="py-number">0</tt><tt class="py-op">,</tt> </tt>
<a name="L174"></a><tt class="py-lineno">174</tt>  <tt class="py-line">        <tt class="py-string">'type'</tt><tt class="py-op">:</tt> <tt class="py-string">""</tt><tt class="py-op">,</tt> </tt>
<a name="L175"></a><tt class="py-lineno">175</tt>  <tt class="py-line">        <tt class="py-string">'time'</tt><tt class="py-op">:</tt><tt class="py-number">0</tt><tt class="py-op">,</tt> </tt>
<a name="L176"></a><tt class="py-lineno">176</tt>  <tt class="py-line">        <tt class="py-string">'changetime'</tt><tt class="py-op">:</tt><tt class="py-number">0</tt><tt class="py-op">,</tt> </tt>
<a name="L177"></a><tt class="py-lineno">177</tt>  <tt class="py-line">        <tt class="py-string">'component'</tt><tt class="py-op">:</tt> <tt class="py-string">""</tt><tt class="py-op">,</tt> </tt>
<a name="L178"></a><tt class="py-lineno">178</tt>  <tt class="py-line">        <tt class="py-string">'severity'</tt><tt class="py-op">:</tt> <tt class="py-string">""</tt><tt class="py-op">,</tt> </tt>
<a name="L179"></a><tt class="py-lineno">179</tt>  <tt class="py-line">        <tt class="py-string">'priority'</tt><tt class="py-op">:</tt> <tt class="py-string">""</tt><tt class="py-op">,</tt> </tt>
<a name="L180"></a><tt class="py-lineno">180</tt>  <tt class="py-line">        <tt class="py-string">'owner'</tt><tt class="py-op">:</tt> <tt class="py-string">""</tt><tt class="py-op">,</tt> </tt>
<a name="L181"></a><tt class="py-lineno">181</tt>  <tt class="py-line">        <tt class="py-string">'reporter'</tt><tt class="py-op">:</tt> <tt class="py-string">""</tt><tt class="py-op">,</tt> </tt>
<a name="L182"></a><tt class="py-lineno">182</tt>  <tt class="py-line">        <tt class="py-string">'cc'</tt><tt class="py-op">:</tt> <tt class="py-string">""</tt><tt class="py-op">,</tt> </tt>
<a name="L183"></a><tt class="py-lineno">183</tt>  <tt class="py-line">        <tt class="py-string">'version'</tt><tt class="py-op">:</tt> <tt class="py-string">""</tt><tt class="py-op">,</tt> </tt>
<a name="L184"></a><tt class="py-lineno">184</tt>  <tt class="py-line">        <tt class="py-string">'milestone'</tt><tt class="py-op">:</tt> <tt class="py-string">""</tt><tt class="py-op">,</tt> </tt>
<a name="L185"></a><tt class="py-lineno">185</tt>  <tt class="py-line">        <tt class="py-string">'status'</tt><tt class="py-op">:</tt> <tt class="py-string">""</tt><tt class="py-op">,</tt> </tt>
<a name="L186"></a><tt class="py-lineno">186</tt>  <tt class="py-line">        <tt class="py-string">'resolution'</tt><tt class="py-op">:</tt> <tt class="py-string">""</tt><tt class="py-op">,</tt> </tt>
<a name="L187"></a><tt class="py-lineno">187</tt>  <tt class="py-line">        <tt class="py-string">'summary'</tt><tt class="py-op">:</tt> <tt class="py-string">""</tt><tt class="py-op">,</tt> </tt>
<a name="L188"></a><tt class="py-lineno">188</tt>  <tt class="py-line">        <tt class="py-string">'description'</tt><tt class="py-op">:</tt> <tt class="py-string">""</tt><tt class="py-op">,</tt> </tt>
<a name="L189"></a><tt class="py-lineno">189</tt>  <tt class="py-line">        <tt class="py-string">'keywords'</tt><tt class="py-op">:</tt> <tt class="py-op">[</tt><tt class="py-op">]</tt> </tt>
<a name="L190"></a><tt class="py-lineno">190</tt>  <tt class="py-line">    <tt class="py-op">}</tt> </tt>
<a name="L191"></a><tt class="py-lineno">191</tt>  <tt class="py-line">    <tt class="py-name">dictOut</tt><tt class="py-op">[</tt><tt class="py-string">"summary"</tt><tt class="py-op">]</tt> <tt class="py-op">=</tt> <tt class="py-name">summariser</tt><tt class="py-op">(</tt><tt class="py-name">results</tt><tt class="py-op">)</tt> </tt>
<a name="L192"></a><tt class="py-lineno">192</tt>  <tt class="py-line">    <tt class="py-name">dictOut</tt><tt class="py-op">[</tt><tt class="py-string">"description"</tt><tt class="py-op">]</tt> <tt class="py-op">=</tt> <tt class="py-name">descriptor</tt><tt class="py-op">(</tt><tt class="py-name">results</tt><tt class="py-op">)</tt> </tt>
<a name="L193"></a><tt class="py-lineno">193</tt>  <tt class="py-line">    <tt class="py-keyword">for</tt> <tt class="py-name">key</tt><tt class="py-op">,</tt> <tt class="py-name">value</tt> <tt class="py-keyword">in</tt> <tt class="py-name">kwargs</tt><tt class="py-op">.</tt><tt class="py-name">items</tt><tt class="py-op">(</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<a name="L194"></a><tt class="py-lineno">194</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-name">dictOut</tt><tt class="py-op">.</tt><tt class="py-name">has_key</tt><tt class="py-op">(</tt><tt class="py-name">key</tt><tt class="py-op">)</tt> <tt class="py-keyword">and</tt> <tt class="py-name">isinstance</tt><tt class="py-op">(</tt><tt class="py-name">value</tt><tt class="py-op">,</tt> <tt class="py-name">dictOut</tt><tt class="py-op">.</tt><tt class="py-name">get</tt><tt class="py-op">(</tt><tt class="py-name">key</tt><tt class="py-op">,</tt><tt class="py-string">""</tt><tt class="py-op">)</tt><tt class="py-op">.</tt><tt class="py-name">__class__</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<a name="L195"></a><tt class="py-lineno">195</tt>  <tt class="py-line">            <tt class="py-name">dictOut</tt><tt class="py-op">[</tt><tt class="py-name">key</tt><tt class="py-op">]</tt> <tt class="py-op">=</tt> <tt class="py-name">value</tt> </tt>
<a name="L196"></a><tt class="py-lineno">196</tt>  <tt class="py-line">    <tt class="py-keyword">return</tt> <tt id="link-23" class="py-name" targets="Function ProctorTicket.Utils.dictFilter()=ProctorTicket.Utils-module.html#dictFilter"><a title="ProctorTicket.Utils.dictFilter" class="py-name" href="#" onclick="return doclink('link-23', 'dictFilter', 'link-23');">dictFilter</a></tt><tt class="py-op">(</tt><tt id="link-24" class="py-name" targets="Function ProctorTicket.Utils.dictEmptiness()=ProctorTicket.Utils-module.html#dictEmptiness"><a title="ProctorTicket.Utils.dictEmptiness" class="py-name" href="#" onclick="return doclink('link-24', 'dictEmptiness', 'link-24');">dictEmptiness</a></tt><tt class="py-op">,</tt> <tt class="py-name">dictOut</tt><tt class="py-op">)</tt> </tt>
</div><a name="L197"></a><tt class="py-lineno">197</tt>  <tt class="py-line"> </tt><script type="text/javascript">
<!--
expandto(location.href);
// -->
</script>
</pre>
<br />
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar" border="0" width="100%" cellpadding="0"
       bgcolor="#a0c0ff" cellspacing="0">
  <tr valign="middle">
  <!-- Home link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="ProctorTicket-module.html">Home</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Tree link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Index link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Help link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Project homepage -->
      <th class="navbar" align="right" width="100%">
        <table border="0" cellpadding="0" cellspacing="0">
          <tr><th class="navbar" align="center"
            ><a class="navbar" target="_top" href="http://code.google.com/p/proctorticket">ProctorTicket</a></th>
          </tr></table></th>
  </tr>
</table>
<table border="0" cellpadding="0" cellspacing="0" width="100%%">
  <tr>
    <td align="left" class="footer">
    Generated by Epydoc 3.0beta1 on Sat Jan 19 19:26:41 2008
    </td>
    <td align="right" class="footer">
      <a href="http://epydoc.sourceforge.net">http://epydoc.sourceforge.net</a>
    </td>
  </tr>
</table>

<script type="text/javascript">
  <!--
  // Private objects are initially displayed (because if
  // javascript is turned off then we want them to be
  // visible); but by default, we want to hide them.  So hide
  // them unless we have a cookie that says to show them.
  checkCookie()
  // -->
</script>
  
</body>
</html>
